package com.codegeek.project.mybatisTypeHandler.struct;

import com.alibaba.fastjson.JSONArray;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.List;

/**
 * @author wj
 * @ClassName 传感器类型项
 * @Description
 * @date 2020-02-20
 */
public class CGSensorTypeItem {

    public static final Logger logger = LogManager.getLogger("FileUtils");

    /* 项名称*/
    private String name;

    /* 项单位*/
    private String unit;

    /**
     * @title CGSensorTypeItem
     * @description 构造方法
     * @param name 项名称
     * @param unit 项单位
     * @return null
     * @throws
     */
    public CGSensorTypeItem(String name,String unit){
        this.name=name;
        this.unit=unit;
    }

    /**
     * @title 默认构造
     * @description
     * @param
     * @return
     * @throws
     */
    public CGSensorTypeItem(){
        this.name=null;
        this.unit=null;
    }

    static public List<CGSensorTypeItem> parseListFromJsonString(String str){
        try {
            return JSONArray.parseArray(str,CGSensorTypeItem.class);
        }
        catch (Exception e){
            e.printStackTrace();
            logger.error(e);
            return null;
        }

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }
}
